#include "params.h"

sm9_BN BN;

/*
    BN 曲线相关参数的初始化
 */
void SM9Params_init(struct SM9Params *bn)
{
    Get(&bn->t,(char *)"600000000058F98A",HEX);
    Get(&bn->q,(char *)"B640000002A3A6F1D603AB4FF58EC74521F2934B1A7AEEDBE56F9B27E351457D",HEX);    // q = 36*t^4 + 36*t^3 + 24*t^2 + 6*t + 1 = (((t + 1)*6*t + 4)*t + 1)*6*t + 1
    Get(&bn->tr,(char *)"D8000000019062ED0000B98B0CB27659",HEX);   //  tr = 6*t^2 + 1
    Get(&bn->n,(char *)"B640000002A3A6F1D603AB4FF58EC74449F2934B18EA8BEEE56EE19CD69ECF25",HEX);   //  n = p + 1 - tr
    Get(&bn->ord,(char *)"41505174165881477438",DEC);   // ord = 6*t+2
    Get(&bn->exp_64,(char *)"82434016654578246444830763105245969129603161266935169637912592173415460324732",DEC); //64^((q-1)/12) mod q
    Get(&bn->exp__8,(char *)"49027451696706212072049108441259109200986788103413520360356476091992042164241",DEC); //(-8)^((q-1)/12) mod q
    Get(&bn->exp__2,(char *)"28559166513296912346466834407128128229200165862230698399494071135560376478091",DEC); //(-2)^((q-1)/12) mod q
    Get(&bn->exp_4,(char *)"5958342662901643427453578939755302545063035311436308304692",DEC);  //(4)^((q-1)/12) mod q
    Get(&bn->exp_6t_5,(char *)"41505174165881477441",DEC);   // 6t+5
    Get(&bn->exp_6t_2_1,(char *)"287113247090025866038862047391696189017",DEC);   // 6t^2+1
    Get(&bn->ONE,(char *)"1",DEC);
    Get(&bn->ZERO,(char *)"0",DEC);
}

